from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support.ui import Select
from time import sleep
from options import options
from service import service

dr=webdriver.Chrome(options=options,service=service)
url=r'http://172.16.22.105:8080/bsams/front/login.do'
dr.get(url)
dr.maximize_window()
sleep(3)

# 登录
# 任务id
dr.find_element(By.ID,'taskId').clear()
dr.find_element(By.ID,'taskId').send_keys('1')
sleep(1)
# 用户名
dr.find_element(By.ID,'loginName').clear()
dr.find_element(By.ID,'loginName').send_keys('liushun01')
sleep(1)
# 密码
dr.find_element(By.ID,'password').clear()
dr.find_element(By.ID,'password').send_keys('123123')
sleep(1)
# 验证码
dr.find_element(By.ID,'vericode').clear()
dr.find_element(By.ID,'vericode').send_keys('shtd')
sleep(1)
# 登录按钮
dr.find_element(By.XPATH,'//*[@id="fmedit"]/div[2]/div[6]/input').click()
sleep(1)

dr.find_element(By.LINK_TEXT,'供应商').click()
sleep(1)
# 正常状态下搜索
ele=dr.find_element(By.NAME,'status')
Select(ele).select_by_index(1)
sleep(1)

dr.find_element(By.ID,'title').clear()
dr.find_element(By.ID,'title').send_keys('辽宁异界公司')
sleep(1)

dr.find_element(By.XPATH,'//*[@id="fmsearch"]/div[3]/input')
sleep(1)

dr.quit()
sleep(3)